Skip to content

Restore 4 uniqueness removed in #998 where no xsd:key covers it (+ must-fail guards)#1032

Open
thbar wants to merge 14 commits into
v2_remove_uniquefrom
v2_remove_unique_regression_fix
Open

Restore 4 uniqueness removed in #998 where no xsd:key covers it (+ must-fail guards)#1032
thbar wants to merge 14 commits into
v2_remove_uniquefrom
v2_remove_unique_regression_fix

Conversation

@thbar

@thbar thbar commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Scope of this PR

This PR restores the missing xsd:unique — otherwise v2.0.1 would not be a correct optimisation, since it would silently drop validation that v2.0.0 had (these four were enforced in v2.0.0 via xsd:unique).

It does not replace them with xsd:key. For GroupOfLinkSequences, afaik xsd:key was there before v2.0.0, but has removed by #721/#462 before v2.0.0 was released (which is why it's important to avoid also removing unique here).

Whether to (re)introduce keys is a separate discussion we can have, but not the scope of this PR (and maybe not for a v2.0.1 bug fix either).

Comment thread xsd/NeTEx_publication.xsd
</xsd:key>
<!-- =====GroupOfLinkSequences============================== -->
<!-- =====GroupOfLinkSequences unique========================== -->
<xsd:unique name="GroupOfLinkSequences_UniqueBy_Id_Version">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think this is correct? For example, why isn't this just a key?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See PR description (just added) ; I think it's more correct that what is in #998 on that specific bit, which was effectively removal of any sort of uniqueness check.

Why not key, well, key has been removed before v2.0.0 (see description). I don't know if adding it back in a patch release is a good idea or not, we'll have to discuss that collectively.

thbar and others added 8 commits June 20, 2026 18:12
Also, assert that the file cannot be considered valid, first and foremost.
ValidBetween lost (afaik) id+version uniqueness in 51b79ea and no xsd:key covers it (guarded by examples/should-fail/duplicate-ValidBetween.xml). Exact verbatim revert, byte-identical to v2.0.

Its selector also covers ValidityCondition/ValidityTrigger/ValidityRuleParameter,
which keys already cover - kept verbatim to stay an exact revert, not trimmed (but this can be covered by a later optimisation).
ValidityPeriod lost id+version uniqueness in 51b79ea and no xsd:key covers it
(guarded by examples/should-fail/duplicate-ValidityPeriod.xml). Should be verbatim revert (compared to v2.0).

Its selector also covers UsageValidityPeriod, which a key already covers - kept
verbatim to stay an exact revert, not trimmed.
Comment thread xsd/NeTEx_publication.xsd
</xsd:key>
<!-- ===== UsageValidityPeriod Key ========================== -->
<!-- ===== UsageValidityPeriodting unique========================== -->
<xsd:unique name="UsageValidityPeriod">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be unique by key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See PR description, I'm just undoing problematic removal of any uniqueness at all, this is not a PR where I'm changing any unique to a key (and as commented above, at least one was removed just pre-v2.0.0, so it would be a bit confusing).

To be discussed, then (but this is not this PR's goal).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A duplicate id is never correct, it is a key. Hence it should not be unique.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skinkie

skinkie commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@thbar read the comments.

@thbar thbar changed the title [WIP] Regression fixes for #998 Restore 4 uniqueness removed in #998 where no xsd:key covers it (+ must-fail guards) Jun 22, 2026
@thbar thbar marked this pull request as ready for review June 22, 2026 15:03
@thbar

thbar commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@thbar read the comments.

I got notified by your other comments, no problem. Now the PR is ready to review.

Hopefully we can merge & we didn't miss any other similar issues, so that #998 can go ahead.

Comment thread xsd/NeTEx_publication.xsd
</xsd:key>
<!-- =====ValidityCondition============================== -->
<!-- =====ValidityCondition unique========================== -->
<xsd:unique name="ValidityCondition_UniqueBy_Id_Version">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be a key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is worth a dedicated ticket (for this one & all the places deserving a key, either removed erroneously before v2.0.0 or not), and its own separate PR(s).

#1032 is just short rollback of 4 missing uniques.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the opposite is true. It was erronousley added as unique, and the removal script removed id unique, because the expectation was a key must exist for an id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, yet the key isn't there, so it creates a larger trouble even (no more unicity at all). We'll need to address that, so I created #1034 ; we'll catalogue over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants